package be.jaisy.osgi.transaction;


public class AbstractTransactionnalService {

	private TransactionTemplate transactionTemplate;

	public void setTransactionManager(ITransactionManager transactionManager) {
		this.transactionTemplate = new TransactionTemplate(transactionManager);
	}

	public void unSetTransactionManager(ITransactionManager transactionManager) {
		this.transactionTemplate = null;
	}
	
	public TransactionTemplate getTransactionTemplate() {
		if(transactionTemplate==null)
			throw new IllegalStateException("Service " + TransactionTemplate.class.getName() + " not registered");
		return transactionTemplate;
	}	
}
